<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Bootstrap 101 Template</title>
  <link href="../lib/bootstrap/css/bootstrap.css" rel="stylesheet">
  <link rel="stylesheet" href="../css/base.css">
  <link rel="stylesheet" href="../css/coupon.css">
  
  <!--[if lt IE 9]>
      <script src="./lib/html5shiv/html5shiv.min.js"></script>
      <script src="./lib/respond/respond.js"></script>
    <![endif]-->
</head>

<body>
  <!-- 头部部分开始 -->
  <div class="header">
    <div class="headerLeft">
      <a href="../index.html">
        <span class=" glyphicon glyphicon-menu-left"></span>
      </a>     
    </div>
    <div class="title">
     优惠券
    </div>
    <div class="headerRight">
      <img src="../images/header_app.png" alt="">
    </div>
  </div>
  <!-- 头部部分结束 -->
  <!-- 主体部分开始 -->
  <div class="MMB_discountCoupon">
    <div class="quan">
      <ul class="content">

      </ul>
    </div>
    <div class="currentPage">
      <ul>
        <li>
          <a href="../index.html">首页</a>
        </li>
        <li>
          <a href="javascript:;">优惠券</a>
        </li>
      </ul>
    </div>
  </div>
  <!-- 主体部分结束 -->
</body>

</html>
<script src="../lib/jquery/jquery.js"></script>
<script src="../lib/bootstrap/js/bootstrap.js"></script>
<script src="../js/template-native.js"></script>
<script type="text/template" id="couponList">
  <%for(var i=0;i<result.length;i++){%>
    <li>
      <a href="./KFC.html?contendId=<%=result[i].couponId%>">
            <img src="<%=result[i].couponImg%>" alt="">
            <p><%=result[i].couponTitle%></p>
        </a>
    </li>
    <% }%>
</script>
<script>
  $(function () {
    $.ajax({      
      url: "http://193.112.55.79:9090/api/getcoupon",
      dataType: "json",
      success: function (result) {
        console.log(result);
        var html = template("couponList", result);
        // console.log(html);
        $(".content").html(html);
      }
    })
  })
</script>